home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 4
/
Aminet 4 - November 1994.iso
/
aminet
/
dev
/
obero
/
oberon_lib.lha
/
oberon-a
/
source1.lha
/
source
/
3rdParty
/
ums.mod
< prev
Wrap
Text File
|
1994-08-08
|
21KB
|
666 lines
(* UMS interface for Oberon-A
** Modified for Oberon-A Release 1.4 by Frank Copeland
*)
MODULE ums;
(*
** $C- CaseChk $I- IndexChk $L+ LongAdr $N- NilChk
** $P- PortableCode $R- RangeChk $S- StackChk $T- TypeChk
** $V- OvflChk $Z- ZeroVars
*)
IMPORT Utility, Exec, Intuition, SYSTEM;
CONST
name = "ums.library";
TYPE
UMSBasePtr * = CPOINTER TO UMSBase;
UMSBase * = RECORD (Exec.Library) END;
VAR
base * : UMSBasePtr;
TYPE
(* msgs are identified by the following type *)
NUM * = LONGINT;
(* general types *)
CONST
MaxMsgs * = MAX(NUM);
NumFields * = 128;
TYPE
APTR * = Exec.APTR;
STRPTR* = Exec.STRPTR;
oldMsg * = ARRAY 16 OF STRPTR;
oldMsgPtr * = CPOINTER TO oldMsg;
MsgTextFields* = ARRAY NumFields OF STRPTR;
MessageInfo* = RECORD
hdrLen* : LONGINT;
txtLen* : LONGINT;
date* : LONGINT;
up*, dn*,
lt*, rt* : LONGINT;
globalStat* : SET;
userStat* : SET;
loginStat* : SET;
hardLink* : LONGINT;
softLink* : LONGINT;
END;
CONST
(* enumeration of fields in an UMS-message *)
msgText * = 0;
fromName * = 1;
fromAddr * = 2;
toName * = 3;
toAddr * = 4;
msgID * = 5;
creationDate*= 6;
receiveDate* = 7;
refID * = 8;
group * = 9;
subject * = 10;
attributes * = 11;
comments * = 12;
organization*= 13;
distribution*= 14;
folder* = 15;
fidoID * = 16;
mausID * = 17;
replyGroup * = 18;
replyName * = 19;
replyAddr * = 20;
fidoText * = 32;
errorText * = 33;
newsreader * = 34;
(* user status-bits *)
archive * = 4; (* msg should be archived, don't delete *)
junk * = 5; (* negative selection, inheritance suggested *)
postPoned * = 6; (* to be read again, (but not now) *)
selected * = 7; (* positive selection, inheritance suggested *)
filtered * = 15; (* msg has been processed by filter,
'selected' and 'junk' have been properly set *)
Old * = 8; (* user has already read this Message *)
Read * = Old;
WriteAccess * = 9; (* user may change or delete this message *)
ReadAccess * = 10; (* user may read this message *)
ViewAccess * = 11; (* user may read the header of this message *)
Owner * = 12; (* user 'owns' (wrote) this message *)
ProtectedUserFlags*= {WriteAccess,ReadAccess,ViewAccess,Owner};
(* global status-bits *)
Deleted * = 0; (* msg is really deleted *)
Expired * = 1; (* msg has expired and may be deleted *)
Exported * = 2; (* msg has been exported *)
Orphan * = 3; (* msg could not be exported *)
Link * = 4; (* within a ring of linked msgs *)
HardLink * = 5; (* link is hardLink *)
ProtectedGlobalFlags*= {Deleted,Exported,Orphan,Link,HardLink};
(*** Errors ***)
CONST
ok* = 0;
unknown* = 1;
codeMissing* = 100;
forbiddenCode*= 101;
noWriteAccess*= 102;
noReader* = 103;
noExporter* = 104;
badLink* = 105;
noWork* = 106;
noSysop* = 107;
badChange* = 108;
dupe* = 200;
noReadAccess* = 201;
noViewAccess* = 202;
msgCorrupted* = 203;
noHdrSpace* = 204;
noSuchMsg* = 205;
badName* = 206;
badTag* = 207;
missingTag* = 208;
noSuchUser* = 209;
notFound* = 210;
autoBounce* = 211;
msgDeleted* = 212;
noNetAccess* = 213;
badPattern* = 214;
badVarname* = 215;
fsFull* = 216;
noMsgMem* = 217;
missingIndex* = 218;
serverTerminated*= 300;
cantWrite* = 301;
cantRead* = 302;
wrongMsgPtr* = 303;
serverNotFree*= 304;
idCountProb* = 305;
noLogin* = 306;
wrongServer* = 307;
noMem* = 308;
wrongTask* = 309;
(* tag-values *)
typeSTRPTR = 2000H;
typeVARPAR = 4000H;
(** tags for WriteUMSMsg() **)
(* add 'typeVARPAR' for ReadUMSMsg() *)
(* no 'typeVARPAR' for WriteUMSMsg() *)
tagMsgNum * = 1 + Utility.tagUser;
tagMsgDate * = 4 + Utility.tagUser;
(* don't usually use when writing! *)
(* Using tagMsgDate with WriteUMSMsg() *)
(* has a very special meaning. *)
tagChainUp * = 7 + Utility.tagUser;
tagHardLink * = 14 + Utility.tagUser;
tagSoftLink * = 15 + Utility.tagUser;
tagAutoBounce * = 65 + Utility.tagUser;
(* when writing: *)
(* data # 0: server returns error 'autoBounce', *)
(* but still keeps the Msg and sends *)
(* it to the sysops. *)
tagHdrFill * = 66 + Utility.tagUser;
(* when writing: how much bytes to be reserved *)
tagTxtFill * = 67 + Utility.tagUser;
(* for header and text *)
tagNoUpdate * = 69 + Utility.tagUser;
(* data = 0: (default) set 'Old'-Flag when *)
(* reading or writing *)
(* data = 1: don't touch 'Old'-Flag *)
tagHide * = 70 + Utility.tagUser;
(* for writing: *)
(* data = 0: default *)
(* data = 1: msg only accessible by exporters *)
(* data = 2: msg only accessible by users *)
tagMsgText * = 256 + typeSTRPTR + Utility.tagUser;
tagFromName * = tagMsgText + 1;
tagFromAddr * = tagMsgText + 2;
tagToName * = tagMsgText + 3;
tagToAddr * = tagMsgText + 4;
tagMsgID * = tagMsgText + 5;
tagCreationDate * = tagMsgText + 6;
tagReceiveDate * = tagMsgText + 7;
tagRefID * = tagMsgText + 8;
tagGroup * = tagMsgText + 9;
tagSubject * = tagMsgText +10;
tagAttributes * = tagMsgText +11;
tagComments * = tagMsgText +12;
tagOrganization * = tagMsgText +13;
tagDistribution * = tagMsgText +14;
tagFolder * = tagMsgText +15;
tagFidoID * = tagMsgText +16;
tagMausID * = tagMsgText +17;
tagReplyGroup * = tagMsgText +18;
tagReplyName * = tagMsgText +19;
tagReplyAddr * = tagMsgText +20;
tagFidoText * = tagMsgText +32;
tagErrorText * = tagMsgText +33;
tagNewsreader * = tagMsgText +34;
(* tagMsgText+15 .. tagMsgText+127 are also usable as text-fields *)
tagTextFields * = 513 + Utility.tagUser;
(* datatype: POINTER TO MsgTextFields *)
(** tags for ReadUMSMsg() **)
(* add 'typeVARPAR' for ReadUMSMsg() *)
(* no 'typeVARPAR' for WriteUMSMsg() *)
tagRMsgNum * = 1 + Utility.tagUser;
tagRHdrLength * = 2 + Utility.tagUser + typeVARPAR;
tagRTxtLength * = 3 + Utility.tagUser + typeVARPAR;
tagRMsgDate * = 4 + Utility.tagUser + typeVARPAR;
tagRChainUp * = 7 + Utility.tagUser + typeVARPAR;
tagRChainDn * = 8 + Utility.tagUser + typeVARPAR;
tagRChainLt * = 9 + Utility.tagUser + typeVARPAR;
tagRChainRt * = 10 + Utility.tagUser + typeVARPAR;
tagRGlobalFlags * = 11 + Utility.tagUser + typeVARPAR;
tagRUserFlags * = 12 + Utility.tagUser + typeVARPAR;
tagRLoginFlags * = 13 + Utility.tagUser + typeVARPAR;
tagRHardLink * = 14 + Utility.tagUser + typeVARPAR;
tagRSoftLink * = 15 + Utility.tagUser + typeVARPAR;
tagRDateStyle * = 64 + Utility.tagUser;
(* style for receiveDate when reading: *)
(* data = 0: no receiveDate *)
(* data = 1: emulate old-style receiveDate *)
tagRIDStyle * = 68 + Utility.tagUser;
(* style for Message-ID *)
(* data = 0: real Message-ID *)
(* data = 1: old style dec-number *)
tagRNoUpdate * = 69 + Utility.tagUser;
(* data = 0: (default) set 'Old'-Flag when *)
(* reading or writing *)
(* data = 1: don't touch 'Old'-Flag *)
tagRMsgText * = 256 + typeSTRPTR + typeVARPAR + Utility.tagUser;
tagRFromName * = tagRMsgText + 1;
tagRFromAddr * = tagRMsgText + 2;
tagRToName * = tagRMsgText + 3;
tagRToAddr * = tagRMsgText + 4;
tagRMsgID * = tagRMsgText + 5;
tagRCreationDate * = tagRMsgText + 6;
tagRReceiveDate * = tagRMsgText + 7;
tagRRefID * = tagRMsgText + 8;
tagRGroup * = tagRMsgText + 9;
tagRSubject * = tagRMsgText +10;
tagRAttributes * = tagRMsgText +11;
tagRComments * = tagRMsgText +12;
tagROrganization * = tagRMsgText +13;
tagRDistribution * = tagRMsgText +14;
tagRFolder * = tagRMsgText +15;
tagRFidoID * = tagRMsgText +16;
tagRMausID * = tagRMsgText +17;
tagRReplyGroup * = tagRMsgText +18;
tagRReplyName * = tagRMsgText +19;
tagRReplyAddr * = tagRMsgText +20;
tagRFidoText * = tagRMsgText +32;
tagRErrorText * = tagRMsgText +33;
tagRNewsreader * = tagRMsgText +34;
(* tagRMsgText+15 .. tagRMsgText+127 are also usable as text-fields *)
tagRMsgInfo * = 512 + Utility.tagUser;
(* datatype: POINTER TO MessageInfo *)
tagRTextFields * = tagRMsgInfo + 1;
(* datatype: POINTER TO MsgTextFields *)
tagRReadHeader * = tagRMsgInfo + 2;
(* read all header-fields *)
tagRReadAll * = tagRMsgInfo + 3;
(* read all text-fields *)
(** tags for UMSSelect() **)
tagSelSet * = 1024 + Utility.tagUser;
(* flags to set on selected msgs *)
tagSelUnset * = tagSelSet + 1;
(* flags to clear *)
tagSelWriteGlobal * = tagSelSet + 2;
(* change global flags, not user-flags *)
tagSelWriteLocal * = tagSelSet + 3;
(* change login-local flags, not user-flags *)
tagSelWriteUser * = tagSelSet + 4+typeSTRPTR;
(* change other user's flags *)
tagSelStart * = tagSelSet + 8;
(* process only msgs AFTER this one *)
tagSelStop * = tagSelSet + 9;
(* process only msgs BEFORE this one *)
(* the following are mutual-exclusiv *)
(* use only one of the following operations, *)
(* otherwise unpredictable things may happen! *)
tagSelReadGlobal * = tagSelSet +10;
(* examine global flags, not user-flags *)
tagSelReadLocal * = tagSelSet +11;
(* examine login-local flags, not user-flags *)
tagSelReadUser * = tagSelSet +12+typeSTRPTR;
(* examine other user's flags *)
tagSelMask * = tagSelSet +16;
(* select msgs, that's flags *)
tagSelMatch * = tagSelSet +17;
(* ANDed with mask equal match *)
tagSelParent * = tagSelSet +18;
(* examine parent's flags *)
tagSelDate * = tagSelSet +19;
(* select msgs younger than this date *)
tagSelTree * = tagSelSet +20;
(* select whole tree this msg is in *)
tagSelSubTree * = tagSelSet +21;
(* select sub-tree this msg is root of *)
tagSelMsg * = tagSelSet +22;
(* select a msg specified by number *)
tagSelQuick * = tagSelSet +23;
(* quick select enabled *)
(* tagMsgText .. tagMsgText+127 are also allowed for selecting *)
(** tags for UMSSearch() **)
tagSearchLast * = 2048 + Utility.tagUser;
(* number of LAST msg not to search *)
tagSearchQuick * = tagSearchLast+ 1;
(* quick searches enabled *)
tagSearchGlobal * = tagSearchLast+ 2;
(* examine global flags instead of user-flags*)
tagSearchLocal * = tagSearchLast+ 3;
(* examine login-local flags, not user-flags *)
tagSearchUser * = tagSearchLast+ 4+typeSTRPTR;
(* examine other user's flags *)
tagSearchDirection * = tagSearchLast+ 5;
(* set search direction *)
(* 0 = default *)
(* 1 = forward *)
(* -1 = backward *)
tagSearchPattern * = tagSearchLast + 6;
(* string in tagMsgText .. tagMsgText+127 is: *)
(* 0: no pattern, just a plain string *)
(* 1: an AmigaDOS style pattern *)
(* 2: a pattern, only if it contains *)
(* wildcards ('auto-detect patterns') *)
tagSearchMask * = tagSearchLast+16;
(* search a msg, that's flags *)
tagSearchMatch * = tagSearchLast+17;
(* ANDed with mask equal match *)
(* tagMsgText .. tagMsgText+127 are also allowed for searching *)
(** tags for ReadUMSConfig(), WriteUMSConfig() **)
tagCfgGlobalOnly * = 3072 + Utility.tagUser;
(* read or write only global config, *)
(* thus must not be combined with tagCfgUser *)
tagCfgName * = tagCfgGlobalOnly+ 1 + typeSTRPTR;
(* name of config var to read or write *)
tagCfgUser * = tagCfgGlobalOnly+ 2 + typeSTRPTR;
(* name of user to read/write locals from/to *)
(** tags for ReadUMSConfig() **)
tagCfgUserName * = tagCfgGlobalOnly+ 3 + typeSTRPTR;
(* alias to get realname from *)
tagCfgNextVar * = tagCfgGlobalOnly+ 4 + typeSTRPTR;
(* get name of next var *)
(** tags for WriteUMSConfig() **)
tagCfgDump * = tagCfgGlobalOnly+16 + typeSTRPTR;
(* write current settings to a file *)
tagCfgData * = tagCfgGlobalOnly+17 + typeSTRPTR;
(* data to write to specified var *)
(*** functions ***)
LIBCALL (base : UMSBasePtr) Login*
( user[2] : ARRAY OF CHAR;
passwd[3] : ARRAY OF CHAR )
: LONGINT;
-30;
LIBCALL (base : UMSBasePtr) Logout*
( account[2] : LONGINT );
-36;
LIBCALL (base : UMSBasePtr) DumpConfig*
( account[2]: LONGINT );
-114;
LIBCALL (base : UMSBasePtr) ErrNum*
( account[2]: LONGINT )
: INTEGER;
-120;
LIBCALL (base : UMSBasePtr) ErrTxt*
( account[2]: LONGINT )
: STRPTR;
-126;
LIBCALL (base : UMSBasePtr) DeleteMsg*
( account[2]: LONGINT;
MsgNum[3] : NUM )
: BOOLEAN;
-132;
LIBCALL (base : UMSBasePtr) ChangeAttributes*
( account[2]: LONGINT;
MsgNum[3] : NUM;
att[4] : ARRAY OF CHAR )
: BOOLEAN;
-138;
LIBCALL (base : UMSBasePtr) NextStatus*
( account[2]: LONGINT;
from[3] : NUM;
mask[4] : SET;
status[5] : SET )
: NUM;
-144;
LIBCALL (base : UMSBasePtr) SetStatus*
( acc[2] : LONGINT;
MsgNum[3] : NUM;
unset[4] : SET;
set[5]: SET);
-162;
LIBCALL (base : UMSBasePtr) PrevStatus*
( acc[2] : LONGINT;
from[3] : NUM;
mask[4] : SET;
status[5] : SET )
: NUM;
-168;
LIBCALL (base : UMSBasePtr) SelStatus*
( acc[2] : LONGINT;
set[3] : SET;
unset[4] : SET;
mask[5] : SET;
status[6] : SET )
: NUM;
-174;
LIBCALL (base : UMSBasePtr) SelGroup*
( acc[2] : LONGINT;
set[3] : SET;
unset[4] : SET;
group[5] : ARRAY OF CHAR )
: NUM;
-180;
LIBCALL (base : UMSBasePtr) GetStatus*
( acc[2] : LONGINT;
MsgNum[3] : LONGINT )
: SET;
-186;
LIBCALL (base : UMSBasePtr) FlushUMS*(); -192;
LIBCALL (base : UMSBasePtr) CleanMB*() : INTEGER; -198;
LIBCALL (base : UMSBasePtr) QuitUMS*(); -204;
(*** V8: ***)
LIBCALL (base : UMSBasePtr) UMSARexxQuery*(); -210;
(*** V9: ***)
LIBCALL (base : UMSBasePtr) ExportedMsg*
( acc[2] : LONGINT;
num[3] : LONGINT );
-234;
LIBCALL (base : UMSBasePtr) CannotExport*
( acc[2] : LONGINT;
num[3] : LONGINT;
error[4] : ARRAY OF CHAR )
: BOOLEAN;
-240;
LIBCALL (base : UMSBasePtr) LogUMS*
( acc[2] : LONGINT;
level[4] : LONGINT;
format[5] : ARRAY OF CHAR;
args[6] : ARRAY OF SYSTEM.BYTE );
-246;
LIBCALL (base : UMSBasePtr) LogUms*
( acc[2] : LONGINT;
level[4] : LONGINT;
format[5] : ARRAY OF CHAR;
args[6].. : LONGINT );
-246;
LIBCALL (base : UMSBasePtr) UMSRLogin*
( server[2] : ARRAY OF CHAR;
user[3] : ARRAY OF CHAR;
passwd[4] : ARRAY OF CHAR )
: LONGINT;
-252;
LIBCALL (base : UMSBasePtr) WriteUMSMsg*
( acc[2] : LONGINT;
tagItems[3]: ARRAY OF Utility.TagItem )
: LONGINT;
-258;
LIBCALL (base : UMSBasePtr) WriteUMSMsgTags*
( acc[2] : LONGINT;
tagItems[3]..: Utility.Tag )
: LONGINT;
-258;
LIBCALL (base : UMSBasePtr) ReadUMSMsg*
( acc[2] : LONGINT;
tagItems[3]: ARRAY OF Utility.TagItem )
: BOOLEAN;
-264;
LIBCALL (base : UMSBasePtr) ReadUMSMsgTags*
( acc[2] : LONGINT;
tagItems[3]..: Utility.Tag )
: LONGINT;
-264;
LIBCALL (base : UMSBasePtr) FreeUMSMsg*
( acc[2] : LONGINT;
msgNum[3] : LONGINT );
-270;
LIBCALL (base : UMSBasePtr) UMSSelect*
( acc[2] : LONGINT;
tagItems[3]: ARRAY OF Utility.TagItem )
: LONGINT;
-276;
LIBCALL (base : UMSBasePtr) UMSSelectTags*
( acc[2] : LONGINT;
tagItems[3]..: Utility.Tag )
: LONGINT;
-276;
LIBCALL (base : UMSBasePtr) UMSSearch*
( acc[2] : LONGINT;
tagItems[3]: ARRAY OF Utility.TagItem )
: LONGINT;
-282;
LIBCALL (base : UMSBasePtr) UMSSearchTags*
( acc[2] : LONGINT;
tagItems[3]..: Utility.Tag )
: LONGINT;
-282;
LIBCALL (base : UMSBasePtr) ReadUMSConfig*
( acc[2]: LONGINT;
tagItems[3]: ARRAY OF Utility.TagItem )
: STRPTR;
-288;
LIBCALL (base : UMSBasePtr) ReadUMSConfigTags*
( acc[2]: LONGINT;
tagItems[3]..: Utility.Tag )
: STRPTR;
-288;
LIBCALL (base : UMSBasePtr) FreeUMSConfig*
( acc[2] : LONGINT;
str[3] : STRPTR);
-294;
LIBCALL (base : UMSBasePtr) WriteUMSConfig*
( acc[2]: LONGINT;
tagItems[3]: ARRAY OF Utility.TagItem )
: BOOLEAN;
-300;
LIBCALL (base : UMSBasePtr) WriteUMSConfigTags*
( acc[2]: LONGINT;
tagItems[3]..: Utility.Tag )
: BOOLEAN;
-300;
LIBCALL (base : UMSBasePtr) PrivateServerCall*
( command[2]: LONGINT;
arg[3] : APTR )
: LONGINT;
-306;
(* $L- Address globals through A4 *)
(*-----------------------------------*)
PROCEDURE* CloseLib;
BEGIN
IF base # NIL THEN Exec.base.CloseLibrary (base) END;
END CloseLib;
(*-----------------------------------*)
PROCEDURE OpenLib * (mustOpen : BOOLEAN);
BEGIN
IF base = NIL THEN
base :=
SYSTEM.VAL
( UMSBasePtr,
Exec.base.OpenLibrary (name, 0));
IF base # NIL THEN SYSTEM.SETCLEANUP (CloseLib)
ELSIF mustOpen THEN HALT (100)
END
END
END OpenLib;
BEGIN
base := NIL
END ums.